package com.yanqu.road.logic.activity.foxcard.game.effect;

import com.yanqu.road.entity.activity.foxcard.FoxHandCard;
import com.yanqu.road.entity.activity.foxcard.UserFoxCardGameData;
import com.yanqu.road.logic.activity.foxcard.game.FoxCardCombo;
import com.yanqu.road.logic.activity.foxcard.game.FoxCardGameLogic;
import com.yanqu.road.logic.activity.foxcard.game.FoxCardShowInfo;
import com.yanqu.road.logic.activity.foxcard.game.eFoxCardTriggerType;

import java.util.Collections;

/**
 * 升级每回合第一次弃掉的牌型
 */
public class FoxCardEffect32 extends FoxCardEffectBase {
    @Override
    protected void effectHandle(FoxCardGameLogic gameLogic, FoxHandCard handCard) {
        if (triggerType != eFoxCardTriggerType.DROP) {
            return;
        }

        UserFoxCardGameData gameData = gameLogic.getGameData();
        boolean isFirstDrop = (gameData.getDropCardTimesMax() - gameData.getDropCardTimes()) == 1;
        if (!isFirstDrop) {
            return;
        }

        FoxCardCombo combo = gameLogic.calcShowCardCombo(gameLogic.getDropHandCards());
        FoxCardShowInfo showInfo = gameLogic.comboLevelUp(combo.getComboId(), 1);
        showInfo.setSettleCards(Collections.singletonList(effectCard));

    }
}
